<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text">
    <br>
    <div id="myDiv">

    </div>
    <script>
        var xmlhttp;
        if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        }else{// code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.open("GET","https://console-mock.apipost.cn/mock/1faf4ce6-e507-45af-9240-13367545a76b/emp/list",true);
        xmlhttp.send();
        // 请求发出之后，直接拿结果，是拿不到的
        // console.log("请求的结果是：",xmlhttp.responseText);
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                console.log("请求的结果是：",xmlhttp.responseText);
            }
        }

    </script>
</body>
</html>